import Vue from 'vue'
import Router from 'vue-router'

import Layout from '@/views/layout/Layout'
import view from '@/index.vue'

// 资源
import CloudHostList from '@/views/resource/cloudhost/list.vue'
import CloudHostDetails from '@/views/resource/cloudhost/details.vue'
import CloudSpecialLineList from '@/views/resource/cloudspecialline/list.vue'
import CloudSpecialLineAddress from '@/views/resource/cloudspecialline/address.vue'
import CloudSpecialDetails from '@/views/resource/cloudspecialline/details.vue'

// 工单
import TyList from '@/views/order/cycloud/list.vue'
import OrderOrigin from '@/views/order/cycloud/orderOrigin.vue'
import OrderDetail from '@/views/order/cycloud/orderDetail.vue'

// 配置流程
import BusinessList from '@/views/config/businessprocesses/list.vue'
import BusinessOrigin from '@/views/config/businessprocesses/origin.vue'
import BusinessDetail from '@/views/config/businessprocesses/detail.vue'
import BusinessCreate from '@/views/config/businessprocesses/create.vue'
import BusinessConfigure from '@/views/config/businessprocesses/configure.vue'
// import { f } from 'tslib'
Vue.use(Router)

export const constantRouterMap = [
  {
    path: '',
    redirect: '/reportform',
    hidden: true
  },
  {
    path: '/order',
    component: Layout,
    meta: { title: '工单', icon: 'gongdan' },
    name: 'order',
    redirect: '/order/orderview/ctyun/list',
    children: [
      {
        path: 'orderview',
        component: view,
        meta: { title: '工单查询', icon: 'gongdan' },
        redirect: '/order/orderview/ctyun/list',
        name: '工单查询',
        children: [
          {
            path: 'ctyun',
            component: view,
            name: 'list',
            meta: { title: '天翼云', icon: 'tianyiyun' },
            // alwaysShow: true,
            children: [
              {
                path: 'list',
                component: TyList,
                name: 'tylist',
                meta: { title: '天翼云', breadcrumb: false, icon: 'tianyiyun' }
                // hidden: true
              },
              {
                path: 'OrderOrigin/:id',
                component: OrderOrigin,
                name: '原始工单',
                meta: { title: '原始工单' },
                hidden: true

              },
              {
                path: 'OrderDetail/:id',
                component: OrderDetail,
                name: 'detail',
                meta: { title: '工单详情' },
                hidden: true

              }
            ]
          }
          // {
          //   path: 'OrderItlist',
          //   component: OrderItlist,
          //   name: 'IT云',
          //   meta: { title: 'IT云', icon: 'ITyun' }
          // }
        ]
      }
    ]
  },
  {
    path: '/resource',
    component: Layout,
    meta: { title: '资源', icon: 'ziyuan1' },
    name: '资源',
    redirect: '/resource/view/cloudhost/list',
    children: [
      {
        path: 'view',
        component: view,
        meta: { title: '天翼云', icon: 'tianyiyun' },
        name: '天翼云',
        redirect: '/resource/view/cloudhost/list',
        children: [
          {
            path: 'cloudhost',
            component: view,
            name: 'cloudhost',
            meta: { title: '云主机', icon: 'yunzhuji' },
            redirect: '/resource/view/cloudhost/list',
            children: [
              {
                path: 'list',
                component: CloudHostList,
                name: '云主机',
                meta: { title: '云主机', icon: 'yunzhuji', breadcrumb: false }
              },
              {
                path: 'details/:id',
                component: CloudHostDetails,
                name: '云主机详情',
                meta: { title: '详情', icon: 'tianyiyun' },
                hidden: true
              }
            ]
          },

          {
            path: 'SpecialCloud',
            component: view,
            name: 'SpecialCloud',
            meta: { title: '云专线', icon: 'yunzhuanxian' },
            redirect: '/resource/ResourceMain/SpecialCloud/list',
            children: [
              {
                path: 'list',
                component: CloudSpecialLineList,
                name: '云专线',
                meta: { title: '云专线', icon: 'yunzhuanxian', breadcrumb: false }
              },
              {
                path: 'Address',
                component: CloudSpecialLineAddress,
                name: '变更地址段',
                meta: { title: '变更地址段', icon: 'tianyiyun' },
                hidden: true
              },
              {
                path: 'DetailsSpecial',
                component: CloudSpecialDetails,
                name: '云专线详情',
                meta: { title: '详情', icon: 'tianyiyun' },
                hidden: true
              }
            ]
          }
        ]
      }
    ]
  },
  {
    path: '/reportform',
    component: Layout,
    name: '报表',
    meta: { title: '报表', icon: 'icon-system-fi-configure' },
    redirect: '/reportform/order/list',
    children: [
      {
        path: 'order',
        component: () => import('@/index.vue'),
        name: '工单报表',
        redirect: '/reportform/order/list',
        meta: { title: '工单报表', icon: 'gongdan' },
        children: [
          {
            path: 'list',
            component: () => import('@/views/reportform/order/list.vue'),
            name: 'reportformList',
            meta: { title: '工单报表', icon: 'gongdan', breadcrumb: false }
          },
          {
            path: 'detail',
            component: () => import('@/views/reportform/order/detail.vue'),
            name: 'reportform-detail',
            meta: { title: '详情', icon: 'gongdan' },
            hidden: true
          }
        ]
      },
      {
        path: 'config',
        component: () => import('@/index.vue'),
        name: '报表配置',
        redirect: '/reportform/config/list',
        meta: { title: '报表配置', icon: 'gongdan' },
        children: [
          {
            path: 'list',
            component: () => import('@/views/reportform/config/list.vue'),
            name: 'config-list',
            meta: { title: '报表配置', icon: 'gongdan', breadcrumb: false }
          },
          {
            path: 'create',
            component: () => import('@/views/reportform/config/create.vue'),
            name: 'config-create',
            meta: { title: '创建' },
            hidden: true
          },
          {
            path: 'edit',
            component: () => import('@/views/reportform/config/edit.vue'),
            name: 'config-edit',
            meta: { title: '编辑' },
            hidden: true
          },
          {
            path: 'detail',
            component: () => import('@/views/reportform/config/detail.vue'),
            name: 'config-detail',
            meta: { title: '详情' },
            hidden: true
          }

        ]
      }
    ]

  },
  {
    path: '/config',
    component: Layout,
    name: 'config',
    meta: { title: '配置', icon: 'icon-system-fi-configure' },
    redirect: '/config/businessprocesses/list',
    children: [
      {
        path: 'businessprocesses',
        component: view,
        name: 'businessprocesses',
        meta: { title: '业务流程', icon: 'gongdan' },
        redirect: '/config/businessprocesses/list',
        // alwaysShow: true,
        children: [
          {
            path: 'list',
            component: BusinessList,
            name: 'businesslistlist',
            meta: { title: '业务流程', icon: 'gongdan', breadcrumb: false }
          },
          {
            path: 'orgin',
            component: BusinessOrigin,
            name: 'businessorigin',
            meta: { title: '历史纪录', icon: 'gongdan' }
          },
          {
            path: 'detail',
            component: BusinessDetail,
            name: 'businessdetail',
            meta: { title: '详情', icon: 'gongdan' }
          },
          {
            path: 'create',
            component: BusinessCreate,
            name: 'businesscreate',
            meta: { title: '创建流程', icon: 'gongdan' }
          },
          {
            path: 'configure',
            component: BusinessConfigure,
            name: 'businessconfigure',
            meta: { title: '配置流程' }
          }
        ]
      }
    ]
  }
]

export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
